import com.fbli.mapper.SelectUserListMapper;
import com.fbli.mapper.TestMapper;
import com.fbli.mapper.UpdatePasswordMapper;
import com.fbli.pojo.Users;
import com.fbli.service.SelectUserListService;
import com.fbli.service.UpdateFormService;

import com.fbli.service.UpdatePasswordService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:spring/applicationContext.xml")
public class testUpdateForm {


    @Autowired
    private UpdateFormService updateFormService;

    @Test
    public void test1(){
        /*username,email,mobile_number,nick_name,name,id_card,location,sex,birthday*/
        /*Users(userid=null, username=admin, password=null, email=, mobileNumber=null, nickName=null, name=, idCard=null, location=, sex=null, birthday=, headPortrait=null)*/

        Users users = new Users();

        users.setUsername("admin");
        users.setEmail("sdfs");
        users.setMobileNumber("238848238423234");
        users.setNickName("dsfsd");
        users.setName("kdsfj");
        users.setIdCard("ksdjfks");
        users.setLocation("shangahai");
        users.setSex("ksdf");
        users.setBirthday("kkdsjfksd");


    updateFormService.updateForm(users);



    }

    @Test
    public void test2(){
        String username = SecurityContextHolder.getContext().getAuthentication().getName();
        System.out.println(username);
    }

    @Autowired
    private UpdatePasswordService updatePasswordService;

    @Test
    public void test3(){
        Users users = new Users();
        users.setUsername("admin");
        Users users1 = updatePasswordService.selectByUsername(users);
        System.out.println(users1);
    }


    @Autowired
    private SelectUserListService selectUserListService;
    @Test
    public void test4(){
        List<Users> users = selectUserListService.selectUserList();
        System.out.println(users);
    }




    @Autowired
    private SelectUserListMapper selectUserListMapper;
    @Test
    public void test5(){
        List<Users> users = selectUserListMapper.selectUserList();
        System.out.println(users);
    }




}
